<template>
	<view class="pinggubaogao">
		<headertop title="评估报告" str="orderlist" str1="oridei" :back1="back1"></headertop>
		<view class="pinggubaogaoiback">

		</view>
		<view class="" :style="{'margin-top':statusBarHeight+'px','width':'100%','height':barHeight+'px'}">
		</view>
		<view class="classify">
			<view class="msgicon" v-if="!list.length">
				<image :src="_static('/images/wxnone.png')" mode="widthFix">
				</image>
				<view class="msgtext">
					暂无报告
				</view>
			</view>
			<view class="itembox" v-for="item in list" :key="item.id" @click="gopage(item.id)">
				<view class="topbox">
					<image :src="_static('/images/微信图片_20250627181332.png')" class="topboxback" mode="">
					</image>
					<view class="datet">
						<span>{{formattedDate(item['createtime'])}}</span>
						<span class="houseminut">{{item['time']}}</span>
					</view>
				</view>
				<view class="bottomcontent">
					<view class="centerbox">
						<view class="line" :key="ind" v-for="(ite,ind) in item['record_detail']">
							<view class="leftneuirong">
								<image :src="ite['image']" class="leicon" mode="" v-if="ite['image']"></image>
								<span>{{ite['title']||'--'}}</span>
							</view>
							<span :style="{'color':ite.color,'fontSize':'24rpx'}">{{ite['score']}}分</span>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		onPageScroll,
		onLoad,
		onShow,
		onReachBottom
	} from "@dcloudio/uni-app";
	import ulm, {
		$api
	} from '@/ulm';
	import {
		ref,
		reactive,
		onMounted
	} from 'vue'
	import headertop from '@/components/header.vue'
	import {
		_static
	} from '@/ulm/utils/url.js'
	const statusBarHeight = ref('')
	const barHeight = ref('')
	const back1 = ref('')
	const flag = ref(false)
	const list = ref([])
	const total = ref('')
	const formData = reactive({
		page: 1,
		list_rows: 10
	})
	onMounted(() => {
		statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight
		const {
			top,
			height
		} = wx.getMenuButtonBoundingClientRect();
		barHeight.value = height ? height + (top - statusBarHeight.value) * 2 : 38;
	})
	onLoad(() => {
		init()
	})
	onReachBottom(() => {
		if (total.value > list.value.length) {
			formData['page']++
			init()
		}
	})

	function boolfun(arr) {
		if (!arr) return false
		var leng = arr.filter(item => item.title)
		if (!leng.length) {
			return false
		} else {
			return true
		}
	}

	function gopage(id) {
		uni.navigateTo({
			url: '/sub_index/index/pinggujieguo?id=' + id
		})
	}
	async function init() {
		const res = await $api.recordevaluation(formData)
		if (res.code == 1) {
			list.value.push(...res.data.data)
			total.value = res.data.total
		}
	}
	onPageScroll((e) => {

		if (e.scrollTop > 100) {
			back1.value = '#81D6FF'
		} else {
			back1.value = ''
		}

	})
	const formattedDate = (timestamp) => {
		const date = timestamp.split('-')
		var month = date[1]
		var day = date[2]
		return `${month}月${day}日`
	}

	function padStart(n) {
		return n.toString().padStart(2, 0)
	}
</script>

<style lang="scss">
	page {
		background: #F7F8FA;
	}

	.msgicon {
		width: 608rpx;
		margin: 100rpx auto;
		overflow: hidden;

		.msgtext {
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			font-size: 28rpx;
			color: #86909C;
			text-align: center;
			width: 100%;
			margin-top: 30rpx;
		}

		image {
			width: 608rpx;
		}
	}

	page {
		background: #F7F8FA;
	}

	.pinggubaogao {
		width: 100%;
		overflow: hidden;
		position: relative;

		.pinggubaogaoiback {
			width: 100%;
			height: 446rpx;
			background: linear-gradient(180deg, #CAEEFF 71%, rgba(240, 250, 255, 0) 100%);
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			position: absolute;
			z-index: -1;
		}

		.classify {
			width: 686rpx;
			overflow: hidden;
			margin: auto;
			margin-top: 32rpx;

			.itembox {
				width: 100%;
				overflow: hidden;
				margin-bottom: 32rpx;
				box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(0, 0, 0, 0.07);
				border-radius: 0rpx 0rpx 24rpx 24rpx;

				.bottomcontent {
					width: 686rpx;
					background: #FFFFFF;
					border-radius: 0rpx 0rpx 24rpx 24rpx;
					overflow: hidden;
					padding: 32rpx 0 0 0;

					.centerbox .line:nth-child(1) .rightfenshu {
						background: #ffece8;
						color: #f53f3f;
					}

					.centerbox .line:nth-child(2) .rightfenshu {
						background: #FFF7E8;
						color: #FF7D00;
					}

					.centerbox .line:nth-child(3) .rightfenshu {
						background: #E8FFEA;
						color: #00B42A;
					}

					.centerbox .line:nth-child(4) .rightfenshu {
						background: #E8FFEA;
						color: #00B42A;
					}

					.centerbox {
						width: 626rpx;
						margin: auto;

						.line {
							width: 100%;
							display: flex;
							align-items: center;
							justify-content: space-between;
							margin-bottom: 24rpx;

							.leftneuirong {
								display: flex;
								align-items: center;
								font-family: PingFang SC, PingFang SC;
								font-weight: 400;
								font-size: 32rpx;
								color: #1D2129;

								.leicon {
									width: 48rpx;
									height: 48rpx;
									margin-right: 20rpx;
								}
							}

							.rightfenshu1 {
								width: 88rpx;
								height: 40rpx;
								background: #E8FFEA;
								border-radius: 4rpx 4rpx 4rpx 4rpx;
								text-align: center;
								line-height: 40rpx;
								font-family: PingFang SC, PingFang SC;
								font-weight: 400;
								font-size: 24rpx;
								color: #00B42A;
							}

							.rightfenshu {
								width: 88rpx;
								height: 40rpx;
								background: #FFECE8;
								border-radius: 4rpx 4rpx 4rpx 4rpx;
								text-align: center;
								line-height: 40rpx;
								font-family: PingFang SC, PingFang SC;
								font-weight: 400;
								font-size: 24rpx;
								color: #F53F3F;
							}
						}
					}
				}

				.topbox {
					width: 686rpx;
					height: 100rpx;
					overflow: hidden;
					position: relative;

					.topboxback {
						position: absolute;
						z-index: -1;
						width: 686rpx;
						height: 100rpx;
					}

					.datet {
						font-family: PingFang SC, PingFang SC;
						font-weight: bold;
						font-size: 36rpx;
						color: #FFFFFF;
						text-indent: 30rpx;
						height: 100rpx;
						display: flex;
						flex-direction: column;
						justify-content: center;

						.houseminut {
							color: #FFFFFF;
							font-size: 28rpx;
						}
					}


				}
			}
		}
	}
</style>